Skip to main content

Environment Variable

The Environment Variable tab allows you to securely manage sensitive environment-specific credentials and configurations (e.g., AWS keys, GCP service account JSON). These variables are injected into Terraform execution environments to authenticate and configure cloud resources.

Overview​

Environment variables can be added, edited, or removed. They are essential for authorizing Terraform operations and ensuring secure, consistent deployments across cloud providers.

GCP Example​

When using GCP, you must configure the GOOGLE_CREDENTIALS variable with your service account JSON. This JSON enables Terraform to authenticate with your GCP project securely.

GCP Environment Variable Example

Expected format for GOOGLE_CREDENTIALS (JSON):

{
"type": "service_account",
"project_id": "atmosly-439606",
"private_key_id": "94bfca26cfc82aec45583d1dea51170cdb369b59",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC...",
"client_email": "terra-infra-mod@atmosly-439606.iam.gserviceaccount.com",
"client_id": "106252534693917194974",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/terra-infra-mod%40atmosly-439606.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}

Steps to Add AWS Credentials​

  1. Navigate to Workspace Details > Environment Variable.
  2. Click Add Variable.
  3. Enter GOOGLE_CREDENTIALS as the Variable Name.
  4. Paste your full JSON credentials in the Value field.
  5. Toggle Is this a secret? to secure sensitive keys.
  6. Click Save.

AWS Environment Variable

The Environment Variable tab allows you to securely manage sensitive environment-specific credentials and configurations required for Terraform to authenticate and deploy resources on AWS.

Overview​

When using AWS, you typically configure multiple environment variables for authentication and region selection.

AWS Environment Variable Example

Common AWS Environment Variables​

Variable NameDescription
AWS_ACCESS_KEY_IDYour AWS access key ID
AWS_SECRET_ACCESS_KEYYour AWS secret access key
AWS_DEFAULT_REGIONAWS region for resource deployment
AWS_SESSION_TOKEN(Optional) Session token for temporary credentials

Steps to Add AWS Credentials​

  1. Navigate to Workspace Details > Environment Variable.
  2. Click Add Variable.
  3. Enter the appropriate Variable Name (e.g., AWS_ACCESS_KEY_ID).
  4. Enter the corresponding Value.
  5. Toggle Is this a secret? to secure sensitive keys.
  6. Repeat steps 2–5 for each required credential you need to configure.
  7. Click Save to store your environment variables.

Tip: Always verify that credentials are correct and have appropriate permissions for your Terraform modules.